import request from '@/request'

export function login(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

export function logout(token) {
  return request({
    headers: {'Authorization': token},
    url: '/logout',
    method: 'get'
  })
}

export function getUserInfo(token) {
  return request({
    headers: {'Authorization': token},
    url: '/users/currentUser',
    method: 'get'
  })
}

export function register(data) {
  return request({
    url: '/register',
    method: 'post',
    data
  })
}

// 登录发送验证码
export function loginSendCode(account) {
  return request({
    url: `/login/${account}`,
    method: 'get',
  })
}

// 注册发送验证码
export function registerSendCode(email) {
  return request({
    url: `/register/${email}`,
    method: 'get',
  })
}

